<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>个人中心</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui-pull-refresh.css" />
    <link rel="stylesheet" type="text/css" href="../../css/common.css" />
    <style>
        html,
        body {
            width: 100%;
            min-height: 100%;
            background: #F3EFEE;
        }

        .aui-active .aui-bar-tab-label {
            color: #f5a51c
        }

        .login {
            height: 240px;
            background-image: -webkit-linear-gradient(0deg, #f5c674, #ed824c);
            /*background-image: url(../../image/personal_bkg.jpg);background-repeat: no-repeat; background-size: cover;*/
            position: relative;
        }

        .login .personal_logo {
            width: 4rem;
            height: 4rem;
            border-radius: 50%;
            margin: 0 auto 9px;
            /*position: absolute; top: 60px; left: 20px;*/
        }

        .login .userinfo {
            position: absolute;
            top: 60px;
            text-align: center;
            left: 0;
            right: 0;
        }

        .login .userinfo .title {
            font-size: 0.8rem;
            color: #fff;
        }
        /* 设置条目 */

        .item {
            height: 3rem;
            line-height: 3rem;
            padding-left: 0.7rem;
            background-color: #fff;
        }

        .item_ico {
            float: left;
            width: 2.3rem;
            padding: 0.7rem 0.7rem 0.7rem 0;
        }

        .item_arrow {
            float: right;
            width: 1.5rem;
            padding: 1rem 0.7rem 1rem 0;
        }

        .item span {
            font-size: 0.7rem;
        }

        [v-cloak] {
            display: none;
        }

        #tab .aui-active {
            color: #ff6565;
            border-bottom: 2px solid #ff6565;
        }

        .aui-list-item-middle {
            padding-left: 0.75rem;
        }

        .aui-radio:checked {
            background-color: #ff6565;
            border: solid 1px #ff6565;
        }

        body {}

        .tab_outer {
            width: 100%;
            overflow-x: scroll;
            position: fixed;
            top: 0;
            z-index: 1;
        }

        .aui-refresh-content {
            min-height: 100vh
        }

        .aui-list-header {
            background: #fff;
            padding: 0.5rem 0.75rem;
            font-size: 0.7rem;
        }
    </style>
</head>

<body>
    <div id="app" style="box-sizing:border-box" v-cloak>

        <ul class="aui-refresh-content" v-if="list.length > 0">
            <li class="aui-list-header">
                退款信息
            </li>
            <li v-for="(items, index) in list" :key="index" @click="refoundAbout(items.o_id)">
                <ul class="aui-list aui-media-list">
                  <li class="aui-list-item-middle">
                    <div class="aui-media-list-item-inner">
                        <div class="aui-list-item-media" style="width:1.4rem;padding-right:5px">
                            <img :src="items.store_logo" class="aui-list-img-sm order_sm_img">
                        </div>
                        <div class="aui-list-item-inner">
                            <div class="aui-list-item-text">
                                <div class="aui-list-item-title aui-font-size-14">{{items.store_name}}</div>
                                <div class="aui-list-item-right order_wait_pay" >{{items.order_status | status}}</div>
                            </div>

                        </div>
                    </div>
                  </li>
                    <li class=" aui-list-item-middle" v-for="item in items.goods" style="background:#f7f7f7;">
                        <div class="aui-media-list-item-inner">
                            <div class="aui-list-item-media" style="width: 4rem;">
                                <img :src="item.goods_pic" class="aui-list-img-md">
                            </div>
                            <div class="aui-list-item-inner">
                                <div class="aui-list-item-text">
                                    <div class="aui-list-item-title" style="width: 70%;">
                                        <div class="aui-font-size-14">{{item.goods_name}}</div>
                                        <div class="aui-list-item-text">{{item.sku_info}}</div>
                                    </div>
                                    <div class="aui-list-item-right" style="text-align:right;">
                                        <div>×{{item.goods_nums}}</div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </li>
                    <!-- @click="payReSales(items.o_id)" -->
                    <li class="aui-list-item aui-list-item-middle" style="margin-top:0.5rem;">
                        <div class="aui-media-list-item-inner">
                            <div class="aui-list-item-media" style="width: 1.6rem;">
                                <img src="../../image/my/m5.png" class="aui-img-round aui-list-img-sm">
                            </div>
                            <div class="aui-list-item-inner aui-list-item-arrow">
                                <div class="aui-list-item-text">
                                    <div class="aui-list-item-title aui-font-size-14">退货退款</div>
                                </div>
                                <div class="aui-list-item-text">
                                    已收到货，需要退换已收到的货
                                </div>
                            </div>
                        </div>
                    </li>
                </ul>
            </li>
        </ul>
        <ul class="aui-refresh-content" v-else>
            <li class="aui-list-header">
                退款信息
            </li>
            <li style="text-align:center;margin: 0.5rem 0">暂无售后订单</li>
          </ul>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/zepto.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript" src="../../script/utils.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/aui-tab.js"></script>
<script type="text/javascript" src="../../script/aui-scroll.js"></script>
<script type="text/javascript" src="../../script/aui-pull-refresh.js"></script>
<script type="text/javascript" src="../../script/aui-toast.js"></script>
<script type="text/javascript">
    apiready = function() {
        var app = new Vue({
            el: '#app',
            data: {
                page: 1,
                totalpage: 1,
                list: [],
                reason_id: 0,
                reason_list: [],
                this_order_id: ''
            },
            created: function() {
                var $_this = this;
                $_this.getList()
                var scroll = new auiScroll({
                    listen: true, //是否监听滚动高度，开启后将实时返回滚动高度
                    distance: 40 //判断到达底部的距离，isToBottom为true
                }, function(ret) {
                    if (ret.isToBottom) {
                        $_this.page++
                            if ($_this.page > $_this.totalpage) {
                                $_this.page = $_this.totalpage
                                return
                            }
                        api.ajax({
                            url: window.Url.Freeorder_myOrder,
                            method: 'post',
                            data: {
                                values: {
                                    token: $api.getStorage('token'),
                                    type: 4,
                                    page: $_this.page,
                                }
                            },
                            timeout: 300,
                        }, function(ret, err) {
                            if (ret) {
                                $_this.list = $_this.list.concat(ret.data.list)

                            } else {
                                api.alert({
                                    msg: JSON.stringify(err)
                                });
                            }
                        })
                    }

                })
            },
            mounted: function() {
                var $_this = this

                var pullRefresh = new auiPullToRefresh({
                    container: document.querySelector('.aui-refresh-content'),
                    triggerDistance: 100
                }, function(ret) {
                    if (ret.status == "success") {
                        $_this.getList(function() {
                            setTimeout(function() {
                                pullRefresh.cancelLoading(); //刷新成功后调用此方法隐藏
                            }, 500)
                        })

                    }
                })
            },
            methods: {
                getList: function(fn) {
                    var $_this = this
                    api.ajax({
                        url: window.Url.Freeorder_myOrder,
                        method: 'post',
                        data: {
                            values: {
                                token: $api.getStorage('token'),
                                type: 6,
                                page: $_this.page,
                            }
                        }
                    }, function(ret, err) {
                        if (ret) {
                            console.log(JSON.stringify(ret))
                            if (ret.re == 1) {
                                $_this.totalpage = ret.data.sum_page
                                $_this.list = ret.data.list
                            } else {
                                $_this.totalpage = 1
                                $_this.list = []
                            }
                            fn && fn()

                        } else {
                            api.alert({
                                msg: JSON.stringify(err)
                            });
                        }
                    })
                },
                payReSales: function(id) {
                    api.openWin({
                        name: 'payReSales',
                        url: './headerone.html',
                        pageParam: {
                            msg: '申请退货',
                            url: './payReSales.html',
                            id: id
                        }
                    });
                },
                refoundAbout: function(id) {
                    api.openWin({
                        name: 'refoundAbout',
                        url: './headerone.html',
                        pageParam: {
                            msg: '退款详情',
                            url: './refoundAbout.html',
                            id: id
                        }
                    })
                }
            },
            filters: {
              status: function (val) {
                switch (Number(val)) {
                  case 1:
                    return '待付款'
                    break;
                  case 2:
                    return '待发货'
                    break;
                  case 3:
                    return '已发货'
                    break;
                  case 4:
                    return '已完成'
                    break;
                  case 5:
                    return '已关闭'
                    break;
                  case 6:
                    return '退款/售后中'
                    break;
                  case 8:
                    return '订单退货中'
                    break;
                  case 9:
                    return '返仓中'
                    break;
                  case 10:
                    return '已返仓'
                    break;
                  default:
                    return
                }
              }
            }
        })
    }
</script>

</html>
